package com.example.sys.async.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.core.controller.BaseController;
import com.example.core.utils.StringUtils;
import com.example.sys.async.service.SysASyncService;
import com.example.sys.async.vo.SysASyncVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("sysASync")
@RestController
public class SysASyncController extends BaseController<SysASyncService, SysASyncVo> {

    @Override
    public QueryWrapper changeFindPageQueryWrapper(SysASyncVo vo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if (!StringUtils.isEmpty(vo.getName())) {
            queryWrapper.like("name", vo.getName());
        }
        if (StringUtils.isNotEmpty(vo.getType().getValue())) {
            queryWrapper.eq("type", vo.getType().getValue());
        }
        queryWrapper.orderByDesc("update_time");
        return queryWrapper;
    }
}
